-------------- An introduction to demo coding on the Amiga ----------------- --------------- By Kreator ---------------- Well due to requests from our readers, I have split this article into two: one part backtracks from last months issue, and covers the copper the other covers what I had originally intended to do this issue but not in as much depth, ie. 3D graphics. One defence an ST owner makes for his plastic breeze-block when challenged by an AMIGA owner is that the ST has a slightly faster 68000 processor ( 8 Mhz compared with the miggys 7.14 Mhz) Unfortunately for him however the Amiga has an array of very powerful custom chips to create wonderful graphics, crisp sounds multiplicities of sprites and bobs and dynamically alter the structure of the display quickly and easily. The latter is what I hope to cover this issue ie. I will be talking about the Copper. The Copper is in fact a very simple processor, it has only three instructions namely WAIT , MOVE , SKIP WAIT X,Y - This instruction tells the copper to wait until the specified position is reached. X is measured in Bus cycles, or 2 low res. pixels, each command has two words which means it takes two bus cycles to process the command ie. we can only specify X to an accuracy of 4 low res pixels. Unfortunately the Vertical Y position is specified in 8 bits ie. from 0 to 255, but there are 313 ( 0 to 312 ) raster lines in a non-interlaced screen.How do we specify these last 57 lines? This is achieved by Waiting until the last possible position recognised by the copper ie. 222,255 , then execute another WAIT instruction. eg. You want WAIT 50,270 instead use: WAIT 222,255 WAIT 50,15 (ie. 270 and 255) MOVE A,REG - Moves the value A into the specified Register. The Copper assumes the REG is an offset to the start of the Custom register area HEX DFF000. eg. Color00 is standard label for the background colour and is at $DFF180 To set the screen to black at position (0,0) use : WAIT 0,0 MOVE 0,$180 SKIP X,Y - Very similar to WAIT but if the position specified has already been passed by the raster beam, then the copper carries on but skips the following instruction. I have never needed to use this command so I won't go into anymore detail. As it happens, no assembler will generate these commands for you they must be encoded yourself. Some of the tedium can be removed however with the use of macros, which take a little longer to assemble but are infinitely easier to debug and follow. See the source on this disk ( in the Custom Registers file ) for examples of this. For obvious reasons I have renamed the MOVE command MOV. The Structure of the commands are as follows ; MOVE Command word 1 bits 0 0-8 9-15 0 Register Unused Command word 2 holds the data word WAIT Command word 1 bits 0 0-7 8-15 1 X position Y position Command word 2 bits 0 1-7 8-14 15 0 X mask Y mask BFD A lot of the second word will look unfamiliar. BFD means Blitter Finished Disable, if this bit is clear the copper will always wait for the blitter to stop before continuing,this is only of any use if you start the blitter from within the copper. The masks allow you to only consider certain bits of the (X,Y) raster position. Thats all for this months intro. the source on the disk also covers setting up screens. Next month I will tell you how to write a scroll routine.